<%@ page import="java.sql.SQLException" %>
<%@ page import="java.sql.Connection" %>
<%@ page import="com.example.util.DBUtil" %>
<%@ page import="java.sql.PreparedStatement" %>
<%@ page import="java.sql.ResultSet" %><%--
  Created by IntelliJ IDEA.
  User: ASUS
  Date: 2021/11/27
  Time: 21:36
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>班级信息显示</title>
</head>
<body>
<%
    try {
        Connection connection = DBUtil.getConnection();
        String sql = "select * from c_user";
        PreparedStatement preparedStatement = connection.prepareStatement(sql);
        ResultSet resultSet = preparedStatement.executeQuery();
        while (resultSet.next()) {
            String cname = resultSet.getString("cname");

            String cgrade = resultSet.getString("cgrade");

            String ctname = resultSet.getString("ctname");

            String cflag = resultSet.getString("cflag");

            String cnum = resultSet.getString("cnum");

            out.println("班级名称:" + cname);
            out.println("<br>");
            out.println("年级:" + cgrade);
            out.println("<br>");
            out.println("班主任名称:" + ctname);
            out.println("<br>");
            out.println("班级口号:" + cflag);
            out.println("<br>");
            out.println("班级人数:" + cnum);
            out.println("<br>");
            out.println("-------------------------------------------------");
            out.println("<br>");
            out.println("-------------------------------------------------");
            out.println("<br>");
        }
    }catch(SQLException e){
        e.printStackTrace();
    }
%>
</body>
</html>
